package rdd.split;


import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;

import java.util.List;

//对接磁盘数据，textFile
public class Spark24_Disk {
    public static void main(String[] args) {
        final SparkConf conf = new SparkConf();
        conf.setMaster("local");
        conf.setAppName("spark");

        final JavaSparkContext jsc = new JavaSparkContext(conf);
        final JavaRDD<String> rdd = jsc.textFile("data/test.txt");                   //textFile可以传入绝对路径，也可以是相对路径；；相对路径是相对项目sparkcore的根目录而言
        List<String> collect = rdd.collect();
        collect.forEach(System.out::println);
        jsc.close();
    }
}
